
    window.onload = async () => {
    const env = {
        serviceUrl: "https://vjmap.com/server/api/v1",
        accessToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6MiwiVXNlcm5hbWUiOiJhZG1pbjEiLCJOaWNrTmFtZSI6ImFkbWluMSIsIkF1dGhvcml0eUlkIjoiYWRtaW4iLCJCdWZmZXJUaW1lIjo4NjQwMCwiZXhwIjo0ODEzMjY3NjM3LCJpc3MiOiJ2am1hcCIsIm5iZiI6MTY1OTY2NjYzN30.cDXCH2ElTzU2sQU36SNHWoTYTAc4wEkVIXmBAIzWh6M",
        exampleMapId: "sys_zp",
        assetsPath: "../../assets/",
        ...__env__ // 如果您已私有化部署，需要连接已部署的服务器地址和token，请打开js/env.js,修改里面的参数
    };
    try {
        // 在线效果查看地址: https://vjmap.com/map3d/demo/#/demo/map/plugins/71plugin3dtilesload
        // --加载3D瓦片--
        let svc = new vjmap3d.Service(env.serviceUrl, env.accessToken);
        let app = new vjmap3d.App(svc, {
            container: "map", // 容器id
            scene: {
                gridHelper: { visible: true } // 是否显示坐标网格
            },
            camera: {  // 相机设置
                viewHelper: { enable: true, position: "leftBottom" } // 是否显示视角指示器
            },
            control: {
                initState: {
                    cameraTarget: new THREE.Vector3(24, 0, 8),
                    cameraPosition: new THREE.Vector3(32, 28, 24),
                }
            }
        })
        let tiles3d = await vjmap3d.loadPlugin3dtiles()
        let offsetParent = new THREE.Group();
        offsetParent.scale.set(0.1, 0.1, 0.1)
        app.scene.add( offsetParent );
        const url = 'https://vjmap.com/map3d/resources/3dtiles/demo/tileset.json';
        let tiles = new tiles3d.TilesRenderer( url );
        tiles.manager.addHandler(/\.gltf$/, vjmap3d.LoadManager.gltfLoader);
        tiles.manager.addHandler(/\.drc$/, vjmap3d.LoadManager.dracoLoader);
        tiles.errorTarget = 2;
        offsetParent.add( tiles.group );
        app.signal.onAppAfterUpdate.add(() => {
            tiles.setCamera( app.camera );
            tiles.setResolutionFromRenderer( app.camera, app.renderer );
            tiles.update()
        })
        
    }
    catch (e) {
        console.error(e);
    }
};